baf3ad844c19fa3d195de05dae3ec49c68182059,plugins/ant/src/com/intellij/lang/ant/psi/impl/AntStructuredElementImpl.java,AntStructuredElementImpl,computeAttributeValue,#String#Set#,373
Before Change
}
else {
if (endProp < value.length() - 1) {
value = value.substring(0, startProp) + resolvedValue + value.substring(endProp + 1);
}
else {
value = value.substring(0, startProp) + resolvedValue;
}
}
}
After Change
protected String computeAttributeValue(String value, Set<PsiElement> elementStack) {
elementStack.add(this);
int startProp = 0;
while ((startProp = value.indexOf("${", startProp)) >= 0) {
final int endProp = value.indexOf('}', startProp + 2);
if (endProp <= startProp + 2) {
startProp += 2;
continue;
}
final String prop = value.substring(startProp + 2, endProp);
final PsiElement propElement = resolveProperty(this, prop);
if (elementStack.contains(propElement)) {
return value;
}
String resolvedValue = null;
if (propElement instanceof AntProperty) {
final AntProperty antProperty = (AntProperty)propElement;
resolvedValue = antProperty.getValue(prop);
if (resolvedValue != null) {
resolvedValue = ((AntStructuredElementImpl)antProperty).computeAttributeValue(resolvedValue, elementStack);
}
}
else if (propElement instanceof Property) {
resolvedValue = ((Property)propElement).getValue();
}
if (resolvedValue == null) {
startProp += 2;
}
else {
final StringBuilder builder = StringBuilderSpinAllocator.alloc();
try {
builder.append(value, 0, startProp);
builder.append(resolvedValue);
if (endProp < value.length() - 1) {
builder.append(value, endProp + 1, value.length());
}
value = builder.toString();
}